package com.yuanqi.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yuanqi.pojo.SalesOrderAttachment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 销售订单附件Mapper接口
 */
@Mapper
public interface SalesOrderAttachmentMapper extends BaseMapper<SalesOrderAttachment> {
    
    /**
     * 根据订单ID查询附件列表
     */
    List<SalesOrderAttachment> selectBySoId(@Param("soId") Long soId);
    
    /**
     * 根据订单ID和状态查询附件列表
     */
    List<SalesOrderAttachment> selectBySoIdAndStatus(@Param("soId") Long soId, @Param("status") Integer status);
    
    /**
     * 根据附件类型查询附件列表
     */
    List<SalesOrderAttachment> selectByAttachmentType(@Param("attachmentType") String attachmentType);
    
    /**
     * 根据上传人查询附件列表
     */
    List<SalesOrderAttachment> selectByUploader(@Param("uploader") String uploader);
    
    /**
     * 统计订单附件数量
     */
    Long countBySoId(@Param("soId") Long soId);
    
    /**
     * 统计订单有效附件数量
     */
    Long countValidBySoId(@Param("soId") Long soId);
}
